// 获取URL地址参数
const getUrlParam = name => {
  let reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)');
  let r = window.location.search.substr(1).match(reg);
  if (r !== null) return decodeURIComponent(r[2]);
  return null;
};

// 获取code值对应文字
const errorCode = code => {
  let errorText = '';
  let language = localStorage.getItem('language');
  let codeValue = localStorage.getItem('errorCode');
  codeValue = codeValue ? JSON.parse(codeValue) : {};
  errorText = codeValue[language][code];
  return errorText;
};

export { getUrlParam, errorCode };
